<!DOCTYPE html>
<html>
<head>
    <title>订单随机立减配置表</title>
		<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
    <!--查询-->
    <el-form :inline="true" class="demo-form-inline" size="small">
        <el-form-item label="类型">
            <el-select v-model="query.randomType" placeholder="请选择">
                <el-option
                        v-for="item in randomTypeList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="queryList">查询</el-button>
        </el-form-item>
        <el-form-item label="编辑">
            <el-switch
                    v-model="openEdit"
                    active-color="#13ce66"
                    inactive-color="#999">
            </el-switch>
        </el-form-item>
        <el-form-item>
            <el-button type="warning" :disabled ="!openEdit" @click="batchUpdate">批量更新</el-button>
        </el-form-item>
    </el-form>
    <!--列表-->
    <el-table size="small" ref="orderRandomConfigTable"
              :data="orderRandomConfig"
              border style="width: 100%" >

        <el-table-column    prop="minOrderAmount"  label="最小订单金额"  width="100">  </el-table-column>

        <el-table-column    prop="maxOrderAmount"  label="最大订单基恩" width="100"  >  </el-table-column>

        <el-table-column    prop="minRandom"  label="最小优惠比例/金额"  width="180">
            <template slot-scope="scope">
                <el-form :model="scope.row"  size="mini"  :ref="'minRandomForm'+scope.row.discountId">
                    <el-form-item class='form-item' prop='minRandom'
                                  :rules="[{data: scope.row, validator:validateMinRandom, type: 'number', trigger: 'change'}]">
                        <el-input v-model.number='scope.row.minRandom' :disabled="!openEdit"></el-input>
                    </el-form-item>
                </el-form>
<!--
                <el-input size="mini"  @change="randomChange(scope.row)" type="number" v-model="scope.row.minRandom" :disabled="!openEdit" ></el-input>
-->
            </template>
        </el-table-column>

        <el-table-column    prop="maxRandom"  label="最大优惠比例/金额"  width="180" >
            <template slot-scope="scope">
                <el-form :model="scope.row"  size="mini"  :ref="'maxRandomForm'+scope.row.discountId">
                    <el-form-item class='form-item' prop='maxRandom'
                                  :rules="[{data: scope.row, validator:validateMaxRandom, trigger: 'change'}]">
                        <el-input v-model.number='scope.row.maxRandom' :disabled="!openEdit"></el-input>
                    </el-form-item>
                </el-form>
<!--
                <el-input size="mini" @change="randomChange(scope.row)" type="number" v-model="scope.row.maxRandom" :disabled="!openEdit" ></el-input>
-->
            </template>
        </el-table-column>

        <el-table-column    prop="minRandomAmount"  label="最小优惠金额限制"  width="180">
            <template slot-scope="scope">
                <el-form :model="scope.row"  size="mini"  :ref="'minRandomAmountForm'+scope.row.discountId">
                    <el-form-item class='form-item' prop='minRandomAmount'
                                  :rules="[{data: scope.row, validator:validateMinRandomAmount, trigger: 'change'}]">
                        <el-input v-model.number='scope.row.minRandomAmount' :disabled="!openEdit"></el-input>
                    </el-form-item>
                </el-form>
                <!--<el-input size="mini" @change="randomAmountChange(scope.row)" type="number" v-model="scope.row.minRandomAmount" :disabled="!openEdit" ></el-input>-->
            </template>
        </el-table-column>

        <el-table-column    prop="maxRandomAmount"  label="最大优惠金额限制" width="180" >
            <template slot-scope="scope">
                <el-form :model="scope.row"  size="mini"  :ref="'maxRandomAmountForm'+scope.row.discountId">
                    <el-form-item class='form-item' prop='maxRandomAmount'
                                  :rules="[{data: scope.row, validator:validateMaxRandomAmount, trigger: 'change'}]">
                        <el-input v-model.number='scope.row.maxRandomAmount' :disabled="!openEdit"></el-input>
                    </el-form-item>
                </el-form>
               <!-- <el-input size="mini" @change="randomAmountChange(scope.row)" type="number" v-model="scope.row.maxRandomAmount" :disabled="!openEdit" ></el-input>-->
            </template>
        </el-table-column>

        <el-table-column    prop="randomCondition"  label="优惠条件"  width="150" >
            <template slot-scope="scope">
                <span v-if="scope.row.randomCondition === 1 ">优惠万元以下</span>
                <span v-if="scope.row.randomCondition === 0 ">优惠万元以上</span>
            </template>
        </el-table-column>

        <el-table-column    prop="randomType"  label="优惠类型" width="150" >
            <template slot-scope="scope">
                <span v-if="scope.row.randomType === 'normal' ">普通订单</span>
                <span v-if="scope.row.randomType === 'quote' ">报价订单</span>
            </template>
        </el-table-column>

        <el-table-column    prop="updateName"  label="更新人"  >  </el-table-column>

        <el-table-column    prop="updateTime"  label="更新时间"  >  </el-table-column>


    </el-table>

</div>

<script src="${request.contextPath}/statics/js/modules/order/orderrandomconfig.js?_${.now?long}"></script>
</body>
</html>